/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hhf.worldzones.services.locationServices.continentServices;

import hhf.flex.annotations.FlexDestination;
import hhf.flex.annotations.services.AddEntities;
import hhf.flex.annotations.services.ArgumentName;
import hhf.flex.annotations.services.CacheServiceId;
import hhf.flex.annotations.services.CanceledService;
import hhf.flex.annotations.services.GenericService;
import hhf.flex.annotations.services.Getter;
import hhf.flex.annotations.services.LinkedServices;
import hhf.flex.annotations.services.OfflinePolicyEnum;
import hhf.flex.annotations.services.ReferenceGetter;
import hhf.flex.annotations.services.RemoveEntities;
import hhf.worldzones.entities.Continent;
import hhf.worldzones.exceptions.ContinentUnknownException;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author HHFrancois
 */
@Local
@FlexDestination
public interface ContinentFacadeLocal {

	@GenericService(offlinePolicy = OfflinePolicyEnum.DELAY)
	@AddEntities(entities = "continent")
	void persist(@ArgumentName(value = "continent") Continent continent);

	Continent merge(Continent continent);

	/*	@LinkedServices(canceledServices = {
	@CanceledService(methodClass = ContinentFacadeLocal.class, method = "findAll"),
	@CanceledService(methodClass = ContinentFacadeLocal.class, method = "find", parameters = "cont.code"),
	@CanceledService(methodClass = CountryFacadeLocal.class, method = "find", parameters = "cont.countries.code"),
	@CanceledService(methodClass = RegionFacadeLocal.class, method = "find", parameters = "cont.countries.regions.code")
	})
	 */
	@GenericService(offlinePolicy = OfflinePolicyEnum.DELAY)
	@RemoveEntities(entities = "cont")
	void remove(@ArgumentName(value = "cont") Continent continent);

	@ReferenceGetter
	Continent find(@CacheServiceId String id) throws ContinentUnknownException;

	//@UniqueKey
	@ReferenceGetter(acceptOutOfDate=true)
	List<Continent> findAll();
	
	@GenericService(needEntityClass = false)
	List<Continent> findAllWithoutOffline();
    

	@ReferenceGetter
	List<Continent> findRange(int[] range);

	@LinkedServices(canceledServices = {
		@CanceledService(methodClass = ContinentFacadeLocal.class, method = "find", parameters = "conts.code")})
	Continent testTest(@ArgumentName(value = "conts") List<Continent> listTest);

	int count();
}
